Copyright: Copyright (C) 1995 devSoft Inc.


UDPPort Control
UDPPort Control (TM)  Version 1.01

Properties              Events              Error Codes             Copyright & Registration

Description

The UDPPort control is used to facilitate UDP (datagram) communications. It can act both as a client and a server and communicate with any number of hosts simultaneously, as well as generate broadcast packets.

File Name

UDPPORT.VBX

Object Type

UDPPort

Remarks

UDPPort needs a Winsock 1.1 compliant TCP/IP subsystem. WINSOCK.DLL must be available in the system path before the control can be used. The Winsock version supported must be at least 1.1.

The interface of the control is similar to the interface of IPPort, only much simpler. The control is activated/deactivated by using the Active property. This property enables/disables sends/receives. The data can be sent in the same way as IPPort, using the DataToSend property. The destination is specified using the RemoteHost and RemotePort properties. Inbound data is received through the DataIn event.

Different from IPPort, UDPPort has no equivalent of a connection. The control can receive datagrams (packets) from any host, and send datagrams to any host. Packets can be broadcasted on the local net by setting the destination to 255.255.255.255.

The operation of the control is completely asynchronous. All the calls except the ones that deal with host name and address resolution, operate through Windows messages (no blocking calls). The gain in performance is considerable when compared to using blocking calls. The only drawback is what some people perceive as "unnatural" programming, but if you were brave enough to come to this sentence, you will be doing fine.

If you have any questions, suggestions, or need any assistance, you can contact us via email at devsoft@aol.com. We will try to answer all messages, however, messages from registered users will have higher priority, so please include your serial number in your message for faster service.

We also strongly recommend that you visit our WWW site at http://www.dev-soft.com/devsoft . There you will find the latest versions of our shareware products as well as other helpful information.


AcceptDataPREF_AcceptData

ActivePREF_Active

BytesSentPREF_BytesSent

ConnectedPREF_Connected

DataInPREF_DataIn

DataToSendPREF_DataToSend

EOLPREF_EOL

HostPREF_Host

HostAddressPREF_HostAddress

HostNamePREF_HostName

InBufferSizePREF_InBufferSize

LingerPREF_Linger

ListeningPREF_Listening

LocalHostPREF_LocalHost

LocalHostNamePREF_LocalHostName

LocalPortPREF_LocalPort

NullsToSendPREF_NullsToSend

OutBufferSizePREF_OutBufferSize

PortPREF_Port

RemoteHostPREF_RemoteHost

RemotePortPREF_RemotePort

WinsockInfoPREF_WinsockInfo

ActionPREF_Action

EncodedDataPREF_EncodedData

DecodedDataPREF_DecodedData

FileNamePREF_FileName

FileCntPREF_FileCnt

FileCntPREF_FileCnt

FormatPREF_Format

IntellicodePREF_Intellicode

MaxFileSizePREF_MaxFileSize

OverwritePREF_Overwrite

ProgressStepPREF_ProgressStep

DecodingUREF_ENCODING

EncodingUREF_ENCODING

UUDecodingUREF_UU_ENCODING

UUEncodingUREF_UU_ENCODING

Base64 DecodingUREF_BASE64_ENCODING

Base64 EncodingUREF_BASE64_ENCODING

Quoted Printable DecodingUREF_QP_ENCODING

Quoted Printable EncodingUREF_QP_ENCODING

ConnectedEREF_Connected

ConnectionRequestEREF_ConnectionRequest

DataInEREF_DataIn

DisconnectedEREF_Disconnected

ReadyToSendEREF_ReadyToSend

ProgressEREF_Progress

EncodeFREF_Encode

DecodeFREF_Decode

True

False

Boolean (Integer)

Integer

Long

String

"" (empty string)

".uue", ".b16", or ".q_p"

Error CodesERROR_CODES

Exported FunctionsEXPORTED_FUNCTIONS

UDPPort

UDPPORT.VBX

udpportcontrol

1.0

Copyright (C) 1995 devSoft Inc. - All Rights Reserved.

$25

#11946

5286


Registration
Copyright Notice

The UDPPort Custom Control (TM) is Copyright (C) 1995 devSoft Inc. - All Rights Reserved.

Registration Procedure

The prices below are for the licenses only and do not include media distribution.  We only send you a set of keys to unlock the software and verify registration by e-mail.  All technical support questions should be directed to:

INTERNET: 	devsoft@aol.com

COMPUSERVE: 	75244,2736

The cost of a single user developer is $25.  You can order via any one of the following channels:

i) ordering through CompuServe Software Registration Service (SWREG)

You can register via CompuServe by going to the Shareware Registration Forum (GO SWREG) and following the forum instructions. The Registration ID for UDPPort is 5286. You can also do a keyword search using the keyword UDPPort.

ii) ordering by Check or Money Order

To order by check or money order please send the attached order form and a check or a money order (payments must be in US Dollars drawn on a US Bank) to:

devSoft Inc.
P.O. Box 13821
Research Triangle Park, NC  27709  U.S.A.

iii) ordering by Credit Card

To order by Visa or MasterCard by E-mail, fax or snail mail send the attached order form  to the above address or:

INTERNET: 	devsoft@aol.com

COMPUSERVE: 	75244,2736

FAX:	(919) 493-5805

Where To Find Our Shareware

The first place to look at is http://www.dev-soft.com/devsoft . There you will find the latest versions of our products, release notes, questions and answers, documentation, press releases, everything you would want to know about us and our products. We strongly recommend that you access that site before contacting us directly.

We will also upload our products in the CompuServe MSBASIC Forum (GO MSBASIC) in Library 17 (3rd Party Tools), as well as in America Online. Usually, the name of the product will be listed as a keyword, so if you try it, you will certainly get a hit.

We will also announce our new releases to the newsgroups of the comp.lang.basic.visual hierarchy, and comp.lang.basic.visual.3rdparty in particular.

Licensing

i) shareware version

You may use the shareware version of UDPPort for up to 30 days in your design environment and for evaluation purposes only. You may copy and distribute it freely as long as all the files in the package, including the demo programs and this help file are distributed with it and no changes or additions of any kind are made to the original package.

There is no charge for any of the above, however, you are specifically prohibited from charging, or requesting donations for any copies, however made, and from distributing UDPPort and/or it's accompanying files with other products (commercial or otherwise) without prior written permission from devSoft Inc.

ii) registered version

As a registered user, you can use UDPPort in your design environment as well as distribute executables that use UDPPort as a runtime component. devSoft asks for no royalties or runtime fees for such distribution. The only requirement is that you distribute a license file which will bear your unique serial number. You will obtain that file upon registration. We also ask you as a courtesy to distribute this help file with your application, but you are not required to do so.

Please note that the rights to the license file are not transferable: users of your application cannot legally use the license for their own applications, or distribute their own code using the a license file with your serial number on it. Only registered users can distribute executables using UDPPort.

You may install only one registered copy of UDPPort in a single workstation at any time. Use of a registered copy in more than one workstation is against the terms of this licensing agreement. In particular, you are specifically prohibited from distributing a registered version of UDPPort except as a runtime component of one of your applications.

Limitation of liability:

THIS SOFTWARE AND THE ACCOMPANYING FILES ARE SOLD "AS IS" AND WITHOUT WARRANTIES AS TO PERFORMANCE OF MERCHANTABILITY OR ANY OTHER WARRANTIES WHETHER EXPRESSED OR IMPLIED. THE EXTENT OF LIABILITY OF THE SELLER IS HEREBY LIMITED EXCLUSIVELY TO PRODUCT REPLACEMENT OR REFUND OF PURCHASE PRICE. IN PARTICULAR, IN NO EVENT SHALL DEVSOFT BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING ANY LOSS OF PROFITS, LOSS OF DATA, INCLUDING BUT NOT LIMITED TO SPECIAL, INCIDENTAL, CONSEQUENTIAL, OR INDIRECT DAMAGES ARISING FROM THE USE OF THIS SOFTWARE.


Order Form
devSoft Inc.

P.O. Box 13821 , Research Triangle Park, NC  27709  U.S.A.

ORDER FORM / INVOICE

Prices are guaranteed through December 1995.

Registration codes will be sent by electronic mail only.  If you need a disk (3.5") or a paper copy of your license, please enclose an additional $5.00 with your order.

Product	No. of Copies 	Price	Total

IPPort	__________ x 	$25.00 =       __________

IPDaemon	__________ x	$25.00 =       __________

 	UDPPort	__________ x	$25.00 =       __________

NetCode	__________ x	$30.00 =       __________

Add  Disk and/or
Paper copy of License	$5.00 =       __________

Total         __________

__________________________________________________________________________________

Name:	Phone:	Date:

Credit card used /Exp. Date

Company Name:

Address:

City, State, Zip/Country:

Name of registrant:

E-Mail address:

Comments:


Properties

*Active	Name
*DataToSend	*OutBufferSize
*InBufferSize	*RemoteHost
Index	*RemotePort
Left	Top
*LocalHostName	*WinsockInfo
*LocalPort


Active Property

Description

This property enables/disables data communications for the control.

Usage

[form.][udpportcontrol.]Active[ = value]

Default Value

False

Remarks

Setting the Active property to True makes UDPPort create a communication endpoint (socket) which can be used for sending and receiving UDP datagrams. Setting it to False destroys the socket and disables data communications.

Data Type

Boolean (Integer)


DataToSend Property

Description

DataToSend is an action property. Assigning a Visual Basic string to this property makes the control send the string to the remote host (note that a Visual Basic string can contain control as well as NULL characters).

Usage

[form.][udpportcontrol.]DataToSend[ = value]

Default Value

"" (empty string)

Remarks

If you are sending data to the remote host faster than it can process it, or faster than the network bandwidth allows, the outgoing queue might fill up. When this happens, DataToSend fails with error 25036: "[10035] Operation would block" (WSAEWOULDBLOCK). Then you can wait for the ReadyToSend event before attempting to send data again.

Different from IPPort and IPDaemon, if DataToSend fails, no data is sent (i.e. the packet is not broken). Also, if the assigned value is larger than the maximum datagram size that the underlying TCP/IP subsystem supports, an error is fired, and no data is sent. A good rule of thumb is to keep datagrams between 1-2KB in size (or smaller, of course).

This property is write-only and not available in design mode.

Data Type

String


InBufferSize Property

Description

Specifies the size (in bytes) of the receiving queue in the underlying TCP/IP provider.

Usage

[form.][udpportcontrol.]InBufferSize[ = value]

Default Value

2048

Remarks

This is the size of an internal queue in the TCP/IP provider. You can increase or decrease its size depending on the amount of data that you will be receiving. Increasing InBufferSize can provide drastic improvements in performance in some cases.

Some TCP/IP implementations do not support variable buffer sizes. If that is the case, when a new connection is accepted, InBufferSize reverts back to its allowable size. The same happens if you attempt to make it too large or too small.

Data Type

Integer


LocalHostName Property

Description

Specifies the domain name of the local host.

Usage

[form.][udpportcontrol.]LocalHostName

Default Value

"" (empty string)

Remarks

This property is read-only.

Data Type

String


LocalPort Property

Description

Specifies the IP port of the local host.

Usage

[form.][udpportcontrol.]LocalPort[ = value]

Default Value

0

Remarks

The LocalPort property must be set before when the Active property is set to True. It instructs the control to bind to a specific port (or communication endpoint) in the local machine.

Setting it to 0 (default) enables Winsock to choose a port at random. The chosen port will be shown by the LocalPort property when the Active property is set to True.

LocalPort cannot be changed once the control is active. Any attempt to set the LocalPort property when the control is active will generate an error.

Data Type

Integer


OutBufferSize Property

Description

Specifies the size (in bytes) of the outgoing queue in the underlying TCP/IP provider.

Usage

[form.][udpportcontrol.]OutBufferSize[ = value]

Default Value

2048

Remarks

This is the size of an internal queue in the TCP/IP provider. You can increase or decrease its size depending on the amount of data that you will be receiving. Increasing OutBufferSize can provide drastic improvements in performance in some cases.

Some TCP/IP implementations do not support variable buffer sizes. If that is the case, when a new connection is accepted, OutBufferSize reverts back to its allowable size. The same happens if you attempt to make it too large or too small.

Data Type

Integer


RemoteHost Property

Description

Specifies the IP number of the remote host in Internet dotted format.

Usage

[form.][udpportcontrol.]RemoteHost[ = value]

Default Value

0.0.0.0

Remarks

The RemoteHost property specifies the destination of UDP datagrams sent through UDPPort. The value of this property can be changed at any time, sending data to another destination.

Setting RemoteHost to 255.255.255.255 enables broadcasts on the local net.

Data Type

String


RemotePort Property

Description

Specifies the IP port of the remote host.

Usage

[form.][udpportcontrol.]RemotePort[ = value]

Default Value

0

Remarks

The RemotePort can be changed at any time, thus changing the destination of the datagrams sent through UDPPort.

Data Type

Integer


WinsockInfo Property

Description

Provides information about the underlying TCP/IP (Winsock) provider.

Usage

[form.][udpportcontrol.]WinsockInfo

Default Value

"" (empty string)

Remarks

WinsockInfo returns a string up to 256 bytes long provided by the underlying Winsock subsystem.

If Winsock fails to initialize successfully, WinsockInfo contains the string "Not Initialized." followed by a description of the error condition.

The property is read-only.

Data Type

String


Events

*DataIn

*ReadyToSend


DataIn Event

Description

Occurs when data arrives from the remote host.

Syntax

Sub udpportcontrol_ConnectionRequest(Datagram As String, SourceAddress As String, SourcePort As Integer)

Remarks

The DataIn event is fired every time a new datagram is received.

Datagram contains the packet as sent by the remote host.

SourceAddress contains the IP number (Internet address) of the remote host, and SourcePort contains the port from which the packet originated.


ReadyToSend Event

Description

Indicates that the underlying TCP/IP subsystem is ready to accept data and send them to the remote host.

Syntax

Sub udpportcontrol_ReadyToSend()

Remarks

The ReadyToSend event is fired when UDPPort is ready to accept data again after a failed DataToSend. (This can happen when the send buffers get full because the remote host(s) cannot accept data as fast as they are generated).


Error Codes

The following is a list of the trappable errors fired by UDPPort:

UDPPort Internal Errors

20106	Winsock error code outside normal range.

20107	You cannot change the LocalPort while UDPPort is Active.

20110	UDPPort must be active for this operation.

Winsock Errors

The error message descriptions show the corresponding Winsock error number. The corresponding Visual Basic error code can be obtained by adding 15001 to the number displayed in the message and vice-versa.

25005	(WSAEINTR)	[10004] Interrupted system call.

25010	(WSAEBADF)	[10009] Bad file number.

25014	(WSAEACCES)	[10013] Permission denied.

25015	(WSAEFAULT)	[10014] Bad address.

25023	(WSAEINVAL)	[10022] Invalid argument.

25025	(WSAEMFILE)	[10024] Too many open files.

25036	(WSAEWOULDBLOCK)	[10035] Operation would block.

25037	(WSAEINPROGRESS)	[10036] Operation now in progress.

25038	(WSAEALREADY)	[10037] Operation already in progress.

25039	(WSAENOTSOCK)	[10038] Socket operation on non-socket.

25040	(WSAEDESTADDRREQ)	[10039] Destination address required.

25041	(WSAEMSGSIZE)	[10040] Message too long.

25042	(WSAEPROTOTYPE)	[10041] Protocol wrong type for socket.

25043	(WSAENOPROTOOPT)	[10042] Bad protocol option.

25044	(WSAEPROTONOSUPPORT)	[10043] Protocol not supported.

25045	(WSAESOCKTNOSUPPORT)	[10044] Socket type not supported.

25046	(WSAEOPNOTSUPP)	[10045] Operation not supported on socket.

25047	(WSAEPFNOSUPPORT)	[10046] Protocol family not supported.

25048	(WSAEAFNOSUPPORT)	[10047] Address family not supported by protocol family.

25049	(WSAEADDRINUSE)	[10048] Address already in use.

25050	(WSAEADDRNOTAVAIL)	[10049] Can't assign requested address.

25051	(WSAENETDOWN)	[10050] Network is down.

25052	(WSAENETUNREACH)	[10051] Network is unreachable.

25053	(WSAENETRESET)	[10052] Net dropped connection or reset.

25054	(WSAECONNABORTED)	[10053] Software caused connection abort.

25055	(WSAECONNRESET)	[10054] Connection reset by peer.

25056	(WSAENOBUFS)	[10055] No buffer space available.

25057	(WSAEISCONN)	[10056] Socket is already connected.

25058	(WSAENOTCONN)	[10057] Socket is not connected.

25059	(WSAESHUTDOWN)	[10058] Can't send after socket shutdown.

25060	(WSAETOOMANYREFS)	[10059] Too many references, can't splice.

25061	(WSAETIMEDOUT)	[10060] Connection timed out.

25062	(WSAECONNREFUSED)	[10061] Connection refused.

25063	(WSAELOOP)	[10062] Too many levels of symbolic links.

25064	(WSAENAMETOOLONG)	[10063] File name too long.

25065	(WSAEHOSTDOWN)	[10064] Host is down.

25066	(WSAEHOSTUNREACH)	[10065] No Route to Host.

25067	(WSAENOTEMPTY)	[10066] Directory not empty.

25068	(WSAEPROCLIM)	[10067] Too many processes.

25069	(WSAEUSERS)	[10068] Too many users.

25070	(WSAEDQUOT)	[10069] Disc Quota Exceeded.

25071	(WSAESTALE)	[10070] Stale NFS file handle.

25072	(WSAEREMOTE)	[10071] Too many levels of remote in path.

25092	(WSASYSNOTREADY)	[10091] Network SubSystem is unavailable.

25093	(WSAVERNOTSUPPORTED)	[10092] WINSOCK DLL Version out of range.

25094	(WSANOTINITIALISED)	[10093] Successful WSASTARTUP not yet performed.

25102	(WSAHOST_NOT_FOUND)	[11001] Host not found.

25103	(WSATRY_AGAIN)	[11002] Non-Authoritative Host not found (try again).

25104	(WSANO_RECOVERY)	[11003] Non-Recoverable error.

25105	(WSANO_DATA)	[11004] Valid name, no data record for requested name.